<template>
  <div class="not-found-container">
    <div class="not-found-content">
      <div class="not-found-icon">
        <el-icon :size="120"><WarningFilled /></el-icon>
      </div>
      <h1 class="not-found-title">404</h1>
      <p class="not-found-message">抱歉，您访问的页面不存在或已被移除</p>
      <div class="not-found-actions">
        <el-button type="primary" size="large" @click="goHome">返回首页</el-button>
        <el-button size="large" @click="goBack">返回上一页</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { useRouter } from 'vue-router'
import { WarningFilled } from '@element-plus/icons-vue'

export default {
  name: 'NotFound',
  components: {
    WarningFilled
  },
  setup() {
    const router = useRouter()
    
    const goHome = () => {
      router.push('/')
    }
    
    const goBack = () => {
      if (window.history.length > 1) {
        router.back()
      } else {
        router.push('/')
      }
    }
    
    return {
      goHome,
      goBack
    }
  }
}
</script>

<style scoped>
.not-found-container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f7fa;
  padding: 20px;
}

.not-found-content {
  text-align: center;
  padding: 40px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 100%;
  animation: fadeIn 0.5s ease-out;
}

.not-found-icon {
  color: #f56c6c;
  margin-bottom: 20px;
  animation: shake 1s ease-in-out;
}

.not-found-title {
  font-size: 72px;
  font-weight: 700;
  color: #303133;
  margin: 0 0 16px 0;
  line-height: 1;
}

.not-found-message {
  font-size: 16px;
  color: #606266;
  margin-bottom: 32px;
  line-height: 1.5;
}

.not-found-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .not-found-container {
    padding: 10px;
  }
  
  .not-found-content {
    padding: 30px 20px;
  }
  
  .not-found-icon {
    font-size: 80px;
  }
  
  .not-found-title {
    font-size: 48px;
  }
  
  .not-found-message {
    font-size: 14px;
  }
  
  .not-found-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .not-found-actions .el-button {
    width: 100%;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .not-found-title {
    font-size: 36px;
  }
  
  .not-found-message {
    font-size: 13px;
  }
}
</style>